public class Hanoi {
    public static void main(String[] args) {
        move(3, 'a', 'b', 'c');
    }
    public static void move(int n, char a, char b, char c) {
        if (n == 1) {
            System.out.printf("从%s上移动第%d个圆盘到%s上\n", a, n, c);
        } else {
            move(n - 1, a, c, b);
            System.out.printf("从%s上移动第%d个圆盘到%s上\n", a, n, c);
            move(n - 1, b, a, c);
        }
    }

}


